package com.usian.user.controller;

import com.usian.apis.userRealname.ApUserRealnameControllerApi;
import com.usian.common.constants.AdminConstans;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1/auth")
public class ApUserRealnameController implements ApUserRealnameControllerApi {
    @Autowired
    private ApUserRealnameService service;

    @PostMapping("findPage")
    @Override
    public ResponseResult findPage(@RequestBody AuthDto dto) {
        return service.findPage(dto);
    }

    @PostMapping("authPass")
    @Override
    public ResponseResult authPass(@RequestBody AuthDto dto) {
        dto.setStatus(AdminConstans.PASS_AUTH);
        return service.updateStatusById(dto);
    }

    @PostMapping("authFail")
    @Override
    public ResponseResult authFail(@RequestBody AuthDto dto) {
        dto.setStatus(AdminConstans.FAIL_AUTH);
        return service.updateStatusById(dto);
    }
}
